Repository navigation
fix(CI): broken cppcheck - #60
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe CI workflow updates actions/checkout and opts into unsafe pull request checkout so the Cppcheck job can successfully analyze pull request head revisions. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/cppcheck.yml" line_range="21" />
<code_context>
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
+ allow-unsafe-pr-checkout: true
- uses: linuxdeepin/action-cppcheck@main
with:
</code_context>
<issue_to_address>
**Pull requests can expose workflow token**
When an untrusted PR supplies files that trigger code execution or an exploitable path while the Cppcheck action processes its checkout, a malicious PR can make the privileged `pull_request_target` job check out and process attacker-controlled files with `linuxdeepin/action-cppcheck@main`; if that processing executes attacker-controlled code or is exploited, the action's `${{ secrets.GITHUB_TOKEN }}` is exposed. The token can then be used with the permissions granted to this workflow.
Run analysis of untrusted PR contents without a privileged token, and perform any token-bearing reporting in a separate trusted job that does not check out or execute the PR head.
</issue_to_address>| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| persist-credentials: false | ||
| allow-unsafe-pr-checkout: true |
There was a problem hiding this comment.
🟠 High · Pull requests can expose workflow token
When an untrusted PR supplies files that trigger code execution or an exploitable path while the Cppcheck action processes its checkout, a malicious PR can make the privileged pull_request_target job check out and process attacker-controlled files with linuxdeepin/action-cppcheck@main; if that processing executes attacker-controlled code or is exploited, the action's ${{ secrets.GITHUB_TOKEN }} is exposed. The token can then be used with the permissions granted to this workflow.
Run analysis of untrusted PR contents without a privileged token, and perform any token-bearing reporting in a separate trusted job that does not check out or execute the PR head.
Prompt for AI agents
In `.github/workflows/cppcheck.yml` at line 21:
**Pull requests can expose workflow token**
When an untrusted PR supplies files that trigger code execution or an exploitable path while the Cppcheck action processes its checkout, a malicious PR can make the privileged `pull_request_target` job check out and process attacker-controlled files with `linuxdeepin/action-cppcheck@main`; if that processing executes attacker-controlled code or is exploited, the action's `${{ secrets.GITHUB_TOKEN }}` is exposed. The token can then be used with the permissions granted to this workflow.
Run analysis of untrusted PR contents without a privileged token, and perform any token-bearing reporting in a separate trusted job that does not check out or execute the PR head.
See also: https://github.com/linuxdeepin/.github/blob/master/workflow-templates/cppcheck.yml and linuxdeepin/deepin-camera#501
Log:
Summary by Sourcery
Restore reliable Cppcheck validation for pull requests.
Bug Fixes:
CI: